const url = require("url");

let u = "http://www.baidu.com:3000/s/html/qf?user=admin&pass=123";
console.log(url.parse(u, true));

let o = {
    protocol: 'http:',
    slashes: true,
    auth: null,
    host: 'www.baidu.com:3000',
    port: '3000',
    hostname: 'www.baidu.com',
    hash: null,
    search: '?user=admin&pass=123',
    query: 'user=admin&pass=123',
    pathname: '/s/html/qf',
    path: '/s/html/qf?user=admin&pass=123',
    href: 'http://www.baidu.com:3000/s/html/qf?user=admin&pass=123'
}
console.log(url.format(o));




